home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / log.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  2KB  |  72 lines

  1. /*
  2.  * @(#)log.h    1.10 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*
  16.  * Logging utilities for debugging.
  17.  */
  18.  
  19. #ifndef _LOG_H_
  20. #define _LOG_H_
  21.  
  22. #ifdef LOGGING
  23.  
  24. #include <stdio.h>
  25.  
  26. /*
  27.  * NOTE: I [Tim] changed command-line parsing of the -l flag to allow
  28.  * -l0 to be passed in.  PERMANENT LOG STATEMENTS SHOULD NOT USE LEVEL 0!
  29.  * It is intended to be used temporarily to limit logging output to
  30.  * specific messages during debugging.  Otherwise even level 1 logging
  31.  * buries you in output.
  32.  */
  33.  
  34. int jio_fprintf(FILE *, const char *fmt, ...);
  35. extern int logging_level;
  36.  
  37. #define Log(level, message) {            \
  38.     if (level <= logging_level)            \
  39.     jio_fprintf(stderr, message);        \
  40. }
  41.  
  42. #define Log1(level, message, x1) {        \
  43.     if (level <= logging_level)            \
  44.     jio_fprintf(stderr, message, (x1));        \
  45. }
  46.  
  47. #define Log2(level, message, x1, x2) {        \
  48.     if (level <= logging_level)            \
  49.     jio_fprintf(stderr, message, (x1), (x2));    \
  50. }
  51.  
  52. #define Log3(level, message, x1, x2, x3) {        \
  53.     if (level <= logging_level)                \
  54.     jio_fprintf(stderr, message, (x1), (x2), (x3));    \
  55. }
  56.  
  57. #define Log4(level, message, x1, x2, x3, x4) {            \
  58.     if (level <= logging_level)                    \
  59.     jio_fprintf(stderr, message, (x1), (x2), (x3), (x4));    \
  60. }
  61.  
  62. #else
  63.  
  64. #define Log(level, message)
  65. #define Log1(level, message, x1)
  66. #define Log2(level, message, x1, x2)
  67. #define Log3(level, message, x1, x2, x3)
  68. #define Log4(level, message, x1, x2, x3, x4)
  69.  
  70. #endif /* LOGGING */
  71. #endif /* !_LOG_H_ */
  72.